<template>
    <div class="banner">
        <div class="container">
            <div class="banner-text">
                <h1>{{ props.name }}</h1>
                <h2>{{ props.enName }}</h2>
            </div>
            <p class="desc" v-if="props.desc">
                {{ props.desc }}
            </p>
        </div>
    </div>
</template>
<script setup>
import { defineProps } from 'vue'
const props = defineProps({
    name: {
        type: String,
        required: true,
    },
    enName: {
        type: String,
        required: true,
    },
    desc: {
        type: String,
        default: '',
    },
})
</script>
<style scoped>
.banner {
    width: 100%;
    height: 400px;
    background-color: transparent;
    background-image: url(../assets/imgs/inner_banner.jpg);
    background-position: center center;
    background-repeat: no-repeat;
    position: relative;
}

.banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.container {
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.banner-text {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    text-align: left;
}

h1,
h2 {
    color: #09a4c3;
    text-align: left;
}

h1 {
    font-size: 40px;
    font-weight: 700;
}
h2 {
    font-size: 20px;
}

.desc {
    width: 60%;
    position: absolute;
    top: 40%;
    color: #666;
    font-size: 18px;
    font-weight: bold;
    transform: translateX(-100vw);
    animation: slideFromLeft 1.2s ease forwards 0.3s;
}

@keyframes slideFromLeft {
    0% {
        opacity: 0;
        transform: translateX(-100vw);
    }
    100% {
        opacity: 1;
        transform: translateX(30%);
    }
}

@media (max-width: 768px) {
    .banner {
        width: 100%;
        height: 230px;
        background-color: transparent;
        background-image: url(../assets/imgs/inner_banner.jpg);
        background-position: center center;
        background-repeat: no-repeat;
        background-size: auto 100%;
        position: relative;
    }
    .banner-text {
        position: absolute;
        top: 30%;
        left: 10%;
        transform: translateY(-50%);
        text-align: left;
    }

    .banner-text {
        h1 {
            font-size: 30px !important;
        }
        h2 {
            font-size: 18px !important;
        }
    }
    .desc {
        width: 50%;
        position: absolute;
        top: 40%;
        right: 20%;
        color: #666;
        font-size: 12px;
        font-weight: bold;
        transform: translateX(-20vw);
        animation: slideFromLeft 1.2s ease forwards 0.3s;
    }
}
</style>
